package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.financing.wap.common.CommonConstantUtil.CommonStatus;
import com.financing.wap.dao.IDstOperationLogDao;
import com.financing.wap.dto.DstOperationLogDTO;
import com.financing.wap.service.IDstOperationLogService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * dst_operation_log  
 * 文章操作流水 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Service("dstOperationLogService")
public class DstOperationLogServiceImpl implements IDstOperationLogService{

	@Autowired
	private IDstOperationLogDao dstOperationLogDao;

	@Override
	public int insert(DstOperationLogDTO dstOperationLog) throws SQLException {
		DTOdateSetUtil.setCreateInfo(dstOperationLog);
		DTOdateSetUtil.setUpdateInfo(dstOperationLog);
		dstOperationLog.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return dstOperationLogDao.insert(dstOperationLog);
	}

	@Override
	public void update(DstOperationLogDTO dstOperationLog) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstOperationLog);
		dstOperationLogDao.update(dstOperationLog);
	}

	@Override
	public void updateForce(DstOperationLogDTO dstOperationLog) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstOperationLog);
		dstOperationLogDao.updateForce(dstOperationLog);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		dstOperationLogDao.delete(id);
	}
	
	@Override
	public List<DstOperationLogDTO> queryList(DstOperationLogDTO dstOperationLog) throws SQLException {
		return dstOperationLogDao.queryList(dstOperationLog);
	}

	@Override
	public int queryListCount(DstOperationLogDTO dstOperationLog) throws SQLException {
		return dstOperationLogDao.queryListCount(dstOperationLog);
	}

	@Override
	public DstOperationLogDTO loadById(Integer id) throws SQLException {
		return dstOperationLogDao.loadById(id);
	}
 	@Override
	public DstOperationLogDTO queryListGetFirst(DstOperationLogDTO dstOperationLog)
			throws SQLException {
		 List<DstOperationLogDTO> queryList = queryList(dstOperationLog);
		 if(queryList==null||queryList.size()==0){
			 return new DstOperationLogDTO();
		 }
		 return queryList.get(0);
	}
}
